1   /*
2    * Copyright (c) 2004-2005, University Health Network.  All rights reserved. Distributed under the BSD 
3    * license (see http://opensource.org/licenses/bsd-license.php).
4    *  
5    * SpringUtil.java
6    *
7    * Created on 29-Dec-2004 at 2:17:45 PM
8    */
9   package ca.uhn.cache.util;
10  
11  
12  
13  /***
14   * Utility method to be used by the test cases that require spring. 
15   * 
16   * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara</a>
17   * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:00 $ by $Author: bryan_tripp $
18   */
19  public final class SpringTestCaseUtils {
20      
21      /***
22       * Converts a package to a path.
23       * 
24       * Ex.: ca.uhn.cache => ca/uhn/ca
25       * 
26       * @param thePackage The package to convert.
27       * @return The coverted package path.
28       */
29      publicong> static final String packageToPath( Package thePackage ) {
30          return thePackage.getName().replaceAll( "//.", "/" );
31      }
32      
33  //    /***
34  //     * For example:
35  //     * 
36  //     * The config location of the fixture foo.bar.TheFixtureTest is:
37  //     * 
38  //     * foo/bar/spring-the-fixture.xml
39  //     * 
40  //     * @param theClazz The test fixture class.
41  //     * @return The location (path) of the <b>spring</b> configuration file for the test fixture.
42  //     */
43  //    public static final String getConfigLocation( Class theClazz ) {
44  //        return packageToPath( theClazz.getPackage() ) + "spring-" + classToFileName( theClazz ) + ".xml";
45  //    }
46  //
47  //    private static String classToFileName( Class theClazz ) {
48  //        StringBuffer buffer = new StringBuffer();
49  //        
50  //        String shortClassName = ClassUtils.getShortClassName( theClazz );
51  //        for (int i = 0; i < shortClassName.length(); i++) {
52  //            char c = shortClassName.charAt(i);
53  //            
54  //            if
55  //            
56  //        }
57  //        return null;
58  //    }
59  
60  }